package org.kjtc.balanceService;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.kjtc.balanceEntity.BalanceBill;
import org.kjtc.balanceEntity.BalanceBillDetail;
import org.kjtc.balanceEntity.BalanceBillMeterDetail;
import org.kjtc.balanceEntity.BalanceInitSetting;
import org.kjtc.balanceEntity.ChargingCostRatio;
import org.kjtc.balanceEntity.ChargingFixedPrice;
import org.kjtc.balanceEntity.ChargingOilPrice;
import org.kjtc.balanceEntity.ChargingRecord;
import org.kjtc.balanceEntity.ChargingTimePrice;
import org.kjtc.balanceEntity.MeterRecord;
import org.kjtc.service.BaseService;
import org.springframework.stereotype.Service;

@Service("costManageService")
public class CostManageService extends BaseService {

	@SuppressWarnings("unchecked")
	public List<BalanceInitSetting> getBalanceInitSetting(BalanceInitSetting balanceInitSetting) throws Exception {
		return (List<BalanceInitSetting>) this.getDaoSupport().findForList("T_CostManage.getBalanceInitSetting", balanceInitSetting);
	}

	public int saveBalanceInitSetting(BalanceInitSetting balanceInitSetting) throws Exception {
		return (int) this.getDaoSupport().update("T_CostManage.insertBalanceInitSetting", balanceInitSetting);
	}

	@SuppressWarnings("unchecked")
	public List<ChargingFixedPrice> getChargingFixedPrice(ChargingFixedPrice chargingFixedPrice) throws Exception {
		return (List<ChargingFixedPrice>) this.getDaoSupport().findForList("T_CostManage.getChargingFixedPrice", chargingFixedPrice);
	}

	@SuppressWarnings("unchecked")
	public List<ChargingFixedPrice> getChargingFixedPriceName(ChargingFixedPrice chargingFixedPrice) throws Exception {
		return (List<ChargingFixedPrice>) this.getDaoSupport().findForList("T_CostManage.getChargingFixedPriceName", chargingFixedPrice);
	}

	public int saveChargingFixedPrice(ChargingFixedPrice chargingFixedPrice) throws Exception {
		return (int) this.getDaoSupport().update("T_CostManage.insertChargingFixedPrice", chargingFixedPrice);
	}

	public int updateChargingFixedPrice(BalanceInitSetting balanceInitSetting) throws Exception {
		return (int) this.getDaoSupport().update("T_CostManage.updateChargingFixedPrice", balanceInitSetting);
	}

	public int deleteChargingFixedPrice(ChargingFixedPrice chargingFixedPrice) throws Exception {
		return (int) this.getDaoSupport().update("T_CostManage.deleteChargingFixedPrice", chargingFixedPrice);
	}

	@SuppressWarnings("unchecked")
	public List<ChargingTimePrice> getChargingTimePrice(ChargingTimePrice chargingTimePrice) throws Exception {
		return (List<ChargingTimePrice>) this.getDaoSupport().findForList("T_CostManage.getChargingTimePrice", chargingTimePrice);
	}

	@SuppressWarnings("unchecked")
	public List<ChargingTimePrice> getChargingTimePriceName(ChargingTimePrice chargingTimePrice) throws Exception {
		return (List<ChargingTimePrice>) this.getDaoSupport().findForList("T_CostManage.getChargingTimePriceName", chargingTimePrice);
	}

	public int saveChargingTimePrice(ChargingTimePrice chargingTimePrice) throws Exception {
		return (int) this.getDaoSupport().update("T_CostManage.insertChargingTimePrice", chargingTimePrice);
	}

	public int updateChargingTimePrice(ChargingTimePrice chargingTimePrice) throws Exception {
		return (int) this.getDaoSupport().update("T_CostManage.updateChargingTimePrice", chargingTimePrice);
	}

	public int deleteChargingTimePrice(ChargingTimePrice chargingTimePrice) throws Exception {
		return (int) this.getDaoSupport().update("T_CostManage.deleteChargingTimePrice", chargingTimePrice);
	}

	@SuppressWarnings("unchecked")
  	public List<ChargingOilPrice> getOilPriceManage(ChargingOilPrice oilPriceManage) throws Exception {
  		return (List<ChargingOilPrice>) this.getDaoSupport().findForList("T_CostManage.getOilPriceManage", oilPriceManage);
  	}

	@SuppressWarnings("unchecked")
  	public List<ChargingOilPrice> getOilPriceForPeroidDTTM(ChargingOilPrice oilPriceManage) throws Exception {
  		return (List<ChargingOilPrice>) this.getDaoSupport().findForList("T_CostManage.getOilPriceForPeriodDTTM", oilPriceManage);
  	}

    public int saveChargingOilPrice(ChargingOilPrice oilPriceManage) throws Exception {
    	return (int) this.getDaoSupport().save("T_CostManage.insertOilPriceManage", oilPriceManage);
	}

    public int updateChargingOilPrice(ChargingOilPrice oilPriceManage) throws Exception {
		return (int) this.getDaoSupport().update("T_CostManage.updateOilPriceManage", oilPriceManage);
	}

	public int deleteChargingOilPrice(ChargingOilPrice oilPriceManage) throws Exception {
		return (int) this.getDaoSupport().update("T_CostManage.deleteOilPriceManage", oilPriceManage);
	}

    @SuppressWarnings("unchecked")
	public List<ChargingCostRatio> getChargingCostRatio(ChargingCostRatio chargingCostRatio) throws Exception {
		return (List<ChargingCostRatio>) this.getDaoSupport().findForList("T_CostManage.getChargingCostRatio", chargingCostRatio);
	}

    @SuppressWarnings("unchecked")
    public List<ChargingCostRatio> createChargingCostRatio(ChargingCostRatio chargingCostRatio) throws Exception {
    	return (List<ChargingCostRatio>) this.getDaoSupport().findForList("T_CostManage.createChargingCostRatio", chargingCostRatio);
    }

    @SuppressWarnings("unchecked")
    public List<ChargingCostRatio> getChargingCostRatioName(ChargingCostRatio chargingCostRatio) throws Exception {
    	return (List<ChargingCostRatio>) this.getDaoSupport().findForList("T_CostManage.getChargingCostRatioName", chargingCostRatio);
    }

    public int saveChargingCostRatio(List<ChargingCostRatio> chargingCostRatioList) throws Exception {
    	Map<String, Object> map = new HashMap<String, Object>();
		map.put("chargingCostRatioList", chargingCostRatioList);
    	return (int) this.getDaoSupport().save("T_CostManage.insertChargingCostRatio", map);
	}

/*    public int updateChargingOilPrice(ChargingCostRatio chargingCostRatio) throws Exception {
		return (int) this.getDaoSupport().update("T_CostManage.updateChargingOilPrice", chargingCostRatio);
	}*/

    @SuppressWarnings("unchecked")
    public List<MeterRecord> getMeterInfo(MeterRecord meterRecord) throws Exception {
    	return (List<MeterRecord>) this.getDaoSupport().findForList("T_CostManage.getMeterInfo", meterRecord);
    }

    @SuppressWarnings("unchecked")
    public List<MeterRecord> getBillMeterRecord(MeterRecord meterRecord) throws Exception {
    	return (List<MeterRecord>) this.getDaoSupport().findForList("T_CostManage.getBillMeterRecord", meterRecord);
    }

    public int getBillMeterRecordCount(MeterRecord meterRecord) throws Exception {
    	return (int) this.getDaoSupport().findForObject("T_CostManage.getBillMeterRecordCount", meterRecord);
    }

    @SuppressWarnings("unchecked")
	public List<BalanceBill> getBalanceBillName(BalanceBill balanceBill) throws Exception {
    	return (List<BalanceBill>) this.getDaoSupport().findForList("T_CostManage.getBalanceBillName", balanceBill);
	}

    @SuppressWarnings("unchecked")
    public List<BalanceBill> getBalanceBill(BalanceBill balanceBill) throws Exception {
    	return (List<BalanceBill>) this.getDaoSupport().findForList("T_CostManage.getBalanceBill", balanceBill);
    }

    public int saveBalanceBill(BalanceBill balanceBill) throws Exception {
    	return (int) this.getDaoSupport().save("T_CostManage.insertBalanceBill", balanceBill);
	}

    public int saveBalanceBillDetail(List<BalanceBillDetail> balanceBillDetailList) throws Exception {
    	Map<String, Object> map = new HashMap<String, Object>();
		map.put("balanceBillDetailList", balanceBillDetailList);
    	return (int) this.getDaoSupport().save("T_CostManage.insertBalanceBillDetail", map);
    }

    public int saveBalanceBillMeterDetail(List<BalanceBillMeterDetail> balanceBillMeterDetailList) throws Exception {
    	Map<String, Object> map = new HashMap<String, Object>();
		map.put("balanceBillMeterDetailList", balanceBillMeterDetailList);
    	return (int) this.getDaoSupport().save("T_CostManage.insertBalanceBillMeterDetail", map);
    }

    @SuppressWarnings("unchecked")
    public List<ChargingRecord> getChargingStationKWH(ChargingRecord chargingRecord) throws Exception {
    	return (List<ChargingRecord>) this.getDaoSupport().findForList("T_CostManage.getChargingStationKWH", chargingRecord);
    }
}
